<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>Hello World</title>
    <script src="react.development.js"></script>
    <script src="react-dom.development.js"></script>
    <script src="babel.min.js"></script>
  </head>
  <body>
    <div id="root"></div>
    <script type="text/babel">

        class NameForm extends React.Component{
            constructor(props){
                super(props);
                this.state = {value:'input there !'};
                this.handleChange = this.handleChange.bind(this);
                this.handleSubmit = this.handleSubmit.bind(this);
            }

            handleChange(event){
                this.setState({value: event.target.value});
            }

            handleSubmit(event){
                alert('you submint is '+this.state.value);
                event.preventDefault();
            }

            render(){
                return (
                    <form onSubmit={this.handleSubmit}>
                        <label>
                            Name:
                            <input type="text" value={this.state.value} onChange={this.handleChange} />
                        </label>
                        <input type="submit" value="Submit" />
                    </form>
                );
            }
        }
      
        ReactDOM.render(
            <NameForm />,
            document.getElementById('root') 
        )
    </script>
  </body>
</html>